#include <iostream>
using namespace std;

#include "error.h"
#include "datetimeutils.h"

int main()
{
  try {
    time_t now; time(&now);
    cerr << strftime("%Y%m%d", time_t_to_tm(now)) << endl;
    
    // why "%Y%m%d", "19980909" doesn't work?
    struct tm tm = strptime("%y%m%d", "980808");
    time_t tm_time = tm_to_time_t(tm);

    for (int i = 0; i < 30; i++) {      
      cerr << tm_time 
	   << " " 
	   << strftime("%Y%m%d", time_t_to_tm(tm_time)) 
	   << endl;
      tm_time += 24 * 3600;
    }

  } catch (Error& e) {
    cerr << "caught error: " << e.msg() << endl;
  }
}
